<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('客户')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input class="form-control" type="text" value="{$row.customer.name|htmlentities}" readonly>
        </div>
    </div>
	<div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('联系人')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="contact_name" class="form-control" type="text" value="{$row.contact.name|htmlentities}" readonly>
        </div>
    </div>
	{if !$row.customer}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('用户名')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input class="form-control" type="text" value="{$row.user.nickname|htmlentities}" readonly>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('手机号')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input class="form-control" type="text" value="{$row.user.phone|htmlentities}" readonly>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('联系人')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="contact_name" class="form-control" type="text" value="{$row.contact.name|htmlentities}" readonly>
        </div>
    </div>
	{/if}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Week_day')}:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <select  id="c-week_day" data-rule="required" class="form-control selectpicker" name="row[week_day]" readonly>
                {foreach name="weekDayList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.week_day"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Date_text')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-date_text" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[date_text]" type="text" value="{$row.date_text}">
        </div>
    </div>


	<div class="form-group">
		<label class="control-label col-xs-12 col-sm-2">本周OKR:</label>
		<div class="col-xs-12 col-sm-8">
			<table class="table fieldlist" data-template="okrtpl" data-name="okr" id="okr-table">
				<tr>
					<th>{:__('目标')}</th>
					<th>{:__('状态')}</th>
<!--					<th>{:__('操作')}</th>-->
				</tr>
				<tr>
					<td colspan="5"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></td>
				</tr>
			</table>
			<textarea name="okr" cols="30" rows="5" style="display: none;">{:json_encode($row->okrs)}</textarea>
			<script id="okrtpl" type="text/html">
				<tr class="form-inline1">
					<td>
						<input type="hidden" name="<%=name%>[<%=index%>][id]" value="<%=row.id%>"/>
						<input type="text" name="<%=name%>[<%=index%>][content]" class="form-control" size="15" value="<%=row.content%>" placeholder="目标"/>
					</td>
					<td>
						<input type="hidden" name="<%=name%>[<%=index%>][status]" class="form-control" id="c-okr-status-<%=index%>" style="width:50px" value="<%=row.status%>" placeholder="状态"/>
						<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-okr-status-<%=index%>" data-yes="1" data-no="0">
							<i class="fa fa-toggle-on text-success <%if(row.status!=1){%>fa-flip-horizontal text-gray<%}%> fa-2x"></i>
						</a>
					</td>
<!--					<td>
						&lt;!&ndash;下面的两个按钮务必保留&ndash;&gt;
						<span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
					</td>-->
				</tr>
			</script>
		</div>
	</div>

	<div class="form-group">
		<label class="control-label col-xs-12 col-sm-2">今日任务:</label>
		<div class="col-xs-12 col-sm-8">
			<p><small class="text-danger">注意：修改和删除带有循环的任务，同样会修改或删除日后的同一个任务</small></p>
			<table class="table fieldlist" data-template="tasktpl" data-name="task" id="first-table">
				<tr>
					<th width="70%">{:__('任务')}</th>
					<th>{:__('状态')}</th>
					<th>{:__('循环')}</th>
				</tr>
				<tr>
					<td colspan="5"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></td>
				</tr>
			</table>
			<textarea name="task" cols="30" rows="5" style="display: none;">{:json_encode($row->tasks)}</textarea>
			<script id="tasktpl" type="text/html">
				<tr class="form-inline1">
					<td>
						<input type="hidden" name="<%=name%>[<%=index%>][id]" value="<%=row.id%>"/>
						<input type="hidden" name="<%=name%>[<%=index%>][cycle_id]" value="<%if(row.cycle_id){%><%=row.cycle_id%><%}else{%>0<%}%>"/>
						<input type="text" name="<%=name%>[<%=index%>][content]" class="form-control" size="15" value="<%=row.content%>" placeholder="任务"/>
					</td>
					<td>
						<input type="hidden" name="<%=name%>[<%=index%>][status]" class="form-control" id="c-task-status-<%=index%>" style="width:50px" value="<%=row.status%>" placeholder="状态"/>
						<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-task-status-<%=index%>" data-yes="1" data-no="0">
							<i class="fa fa-toggle-on text-success <%if(row.status!=1){%>fa-flip-horizontal text-gray<%}%> fa-2x"></i>
						</a>
					</td>
					<td class="cycle_line">
						<div class="col-xs-12 col-md-12" style="margin-bottom: 5px;">
							<select name="<%=name%>[<%=index%>][cycle]" class="form-control cycle_type">
								<option value="0" <%if(row.cycle==0){%>selected<%}%>>单次</option>
								<option value="1" <%if(row.cycle==1){%>selected<%}%>>每天</option>
								<option value="2" <%if(row.cycle==2){%>selected<%}%>>每周</option>
								<option value="3" <%if(row.cycle==3){%>selected<%}%>>每月</option>
								<option value="4" <%if(row.cycle==4){%>selected<%}%>>ZH记忆曲线</option>
							</select>
						</div>
						<div class="col-xs-12 col-md-12 cycle_week plus_select" style="margin-bottom: 5px; <%if(row.cycle!=2){%>display:none;<%}%>">
							{:build_select('cycle_week_sel',['1'=>'周一','2'=>'周二','3'=>'周三','4'=>'周四','5'=>'周五','6'=>'周六','7'=>'周天'],null,['class'=>'form-control selectpicker', 'multiple'=>'true', 'data-val'=>'<%=row.cycle_days%>'])}
						</div>
						<div class="col-xs-12 col-md-12 cycle_month plus_select" style="margin-bottom: 5px; <%if(row.cycle!=3){%>display:none;<%}%>">
							<?php echo build_select('cycle_month_sel',$monthDays,null,['class'=>'form-control selectpicker', 'multiple'=>'true', 'data-val'=>'<%=row.cycle_days%>']) ?>
						</div>
						<input type="hidden" class="cycle_days" name="<%=name%>[<%=index%>][cycle_days]" value="<%=row.cycle_days%>"/>
						<input type="hidden" name="<%=name%>[<%=index%>][cycle_day]" value="<%=row.cycle_day%>"/>
						<input type="hidden" name="<%=name%>[<%=index%>][cycle_id]" value="<%=row.cycle_id%>"/>
						<input type="text" class="cycle_end_date datetimepicker form-control" data-date-format="YYYY-MM-DD" name="<%=name%>[<%=index%>][cycle_end_date]" value="<%=row.cycle_end_date%>" placeholder="结束时间" style="<%if(row.cycle!=1 && row.cycle!=2 && row.cycle!=3){%>display:none;<%}%>">
					</td>
				</tr>
			</script>
		</div>
	</div>
	<div class="form-group">
		<label class="control-label col-xs-12 col-sm-2">{:__('附件')}:</label>
		<div class="col-xs-12 col-sm-8">
			<div class="input-group">
				<input id="c-files" data-rule="required1" class="form-control" size="50" name="row[files]" type="hidden" value="{$row.files}">
				<div class="input-group-addon1 no-border no-padding">
					<span><button type="button" id="plupload-files" class="btn btn-danger plupload" data-input-id="c-files" data-mimetype="*" data-multiple="true" data-preview-id="p-files"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
					<span><button type="button" id="fachoose-files" class="btn btn-primary fachoose" data-input-id="c-files" data-mimetype="*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
				</div>
				<span class="msg-box n-right" for="c-files"></span>
			</div>

			<ul class="row list-inline plupload-preview" id="p-files"></ul>
		</div>
	</div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Notice')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-notice" class="form-control" name="row[notice]" type="text" value="{$row.notice|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Feeling')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-feeling" class="form-control" name="row[feeling]" type="text" value="{$row.feeling|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('咨询师记录')}:</label>
        <div class="col-xs-12 col-sm-8">
			<textarea id="c-note" class="form-control " rows="5" name="row[note]" cols="50">{$row.note|htmlentities}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Ai_reply')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-ai_reply" class="form-control " rows="5" name="row[ai_reply]" cols="50" readonly>{$row.ai_reply|htmlentities}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Ai_reply_time')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-ai_reply_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[ai_reply_time]" type="text" value="{:$row.ai_reply_time?datetime($row.ai_reply_time):''}" readonly>
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
            <button type="button" id="ai" class="btn btn-success-light btn-embossed">{:__('获得AI反馈')}</button>
            <button type="button" id="print" class="btn btn-warning btn-embossed">{:__('打印')}</button>
        </div>
    </div>
</form>
<link href="__CDN__/assets/css/print-A4.css?v={$site.version}" rel="stylesheet">